<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<html>
  <head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
		<title>文章</title>
		<meta name="Keywords" content="微信开发,微信支付,微信demo,demo下载">
		<meta name="description" content="微信开发">
		<link rel="stylesheet" type="text/css" href="<c:url value='/resources/css/base/comment.css'/>" />
		<jsp:include page="iconfont/iconfont.jsp" flush="true"/><!--动态包含-->
		<!--css,js-->
		<jsp:include page="iconfont/iconfont.jsp" flush="true"/><!--动态包含-->
		<!--css,js-->
		<jsp:include page="common/common_head.jsp"></jsp:include>
		<!-- <script type="text/javascript" src="https://cdn.bootcss.com/clipboard.js/1.7.1/clipboard.min.js"></script> -->
		<style>
			*{margin:0;padding:0;}
			body{background: #f7fafc;font-size:14px;}
			h2{font-size:20px;padding: 10px 0;}
			.a-detail-box{min-width:1200px;width:1200px;text-align:center;background-color: #fff;margin-top: 100px;}
			.simg{margin-right:4px;}
			.box{text-align: left;width: 80%;margin: 0 auto;}
			.box>.left-l>div{padding:8px 0;}
			.g-pwd>div{display:inline-block;}
			.layui-layer-btn .layui-layer-btn0{border-color:#0FB557;background-color:#0FB557;color:#fff;padding:3px 35px;}
			.layui-layer-btn{text-align:center;}
			.right-l{position: relative;}
			.l-b{float: right;}
			.common-c-r{display:inline-block;text-align: center;}
			.c-r-right{padding: 0 14px;border-right: 1px solid #EAEEF2;float:right;}
			.c-r-left{padding-left: 14px;}
			.commentList{background: #EFEDED;}
			
			.c-huifu{
				width: 100%;
			    border-top: 1px solid #E8E7E7;
			    background: #EEF0F1;
			    margin: 5px 0 0 0!important;
			    }
			    .huifu-btn{
			    	display: inline-block;
				    background: #F36A6A;
				    color: #fff;
				    padding: 4px 15px;
				    border-radius: 4px;
			    }
			    .huifu-cnt {text-align:center;}
				.huifu-cnt textarea{height:66px;border: none;margin-top: 12px;padding: 0 10px;}
				.huifu-btn-b{text-align: right;padding: 15px 33px;}
				.comment-date span a,.icon-groupcopy5{font-size:14px;}
				.shouqi{color:#A9A9A9;display: inline-block;margin-right: 20px;}
				.pinglun-c{padding: 0 10px;color: #909090;}
				
				.tiny-img{border-radius:50%;}
				.huifu-g-date{float:right;}
				.huifu-g-cnt{margin-left:50px;}
				.huifulist-cnt ul{padding: 5px 0;}
				.huifulist-cnt ul li{margin:15px 40px;background: #EEF0F1;padding: 5px 10px;}
				.huifu-g-date{color:#bbb;}
				
				.dashang{text-align: center;}
		</style>
	<body>
	<!-- S TO TOP-->
	<div class="scroll" style="display: block;">
		<a href="#" class="s_btn"></a>
	</div>
	<!-- E TO TOP -->
	<div class="canvas_box">
		<canvas id="Mycanvas"></canvas>
	</div>
	<%-- <script type="text/javascript" src="<c:url value='/resources/js/canvas_bg.js'/>"></script> --%>
	<!-- 共用头部 -->
	<jsp:include page="common/common.jsp"></jsp:include>
		<div id="vwrap" class="a-detail-box common-header" v-cloak>
			<input v-model="login_token" type="hidden" value="${oatoken_}"/>
			<div class="box">
				<div class="left-l">
					<div><!-- <span class="simg"><img width="15" height="15" :src="goods.goodsImg"> --></span>
						<span class="emphasize-bar"></span>商品名：{{goods.goodsName}}
						<div class="l-b">
							<div class="common-c-r c-r-left"><span class="comm-read-common">{{goods.readCount}}</span><br><span>阅读数</span></div>
						</div>	
					</div>
					<div><img :src="goods.goodsBigImg"></div>
					<div>
						<span class="emphasize-bar"></span>商品描述：
						<span v-if="goods.goodsDesc==null">空</span>
						<span v-else>{{goods.goodsDesc}}</span>
					</div>
					<div>
						<template v-if="goods.state==1">
							<span class="emphasize-bar"></span>价格(元)：<span class="free-goods">{{goods.sellPrice}}</span></div>
						</template>
					<div>
						<span class="emphasize-bar"></span>链接地址：
						<span class="goods-pwd">{{goods.linkPath}}</span>
						<!-- <div id="copy-cnt-btn" style="display: inline-block;" class="js-copy" data-clipboard-text="{{goods.linkPath}}">
					  	 	<span class="click-me-cy">点我复制</span>
					    </div> -->
					</div>
					<!--data-clipboard-text属性的值将会被复制-->
				    <div class="g-pwd">
				    	<span class="emphasize-bar"></span>密码：
					    <div v-if="goods.state!=1"><!-- 这块换成支付状态 -->
							<span class="goods-pwd">{{goods.linkPwd}}</span>
					    	<!-- <div id="copy-cnt-btn" style="display: inline-block;" class="js-copy" data-clipboard-text="{{goods.linkPwd}}">
						  	 	<span class="click-me-cy">点我复制</span>
						    </div> -->
						</div>
						<div v-else>
							<a href="javascript:;" @click="showPwd" class="free-goods">获取密码</a>
						</div>
				    	
				    </div>
					<div>
						<span class="emphasize-bar"></span>状态：
						<span class="pay-amount">
							<template v-if="goods.state==1">
								<span class="nofree-goods">收费</span>
							</template>
							<template v-else>
								<span class="free-goods">免费</span>
							</template>
						</span>
					</div>
					
					<div style="padding:0;" class="dashang" v-show="goods.state==0">
						<span style="cursor:pointer;">
							<svg class="icon" aria-hidden="true">
							    <use xlink:href="#icon-shang"></use>
							</svg>
						</span>
					</div>
					
					
					
				</div>
				<div class="my-comment-box common-header">
			<div class="title-comment">
				<span class="emphasize-bar"></span><span>编辑评论</span>
				<div class="common-c-r c-r-right"><span class="comm-read-common comment-count">{{goods.commentCount}}</span><span>条评论</span></div>
			</div>
			<%-- <div class="user-img">
				<c:if test="${empty curr_user.userPic}"><img width="50" height="50" src="http://img.mukewang.com/57035ff200014b8a06000338-228-128.jpg"/></c:if>
				<c:if test="${not empty curr_user.userPic}"><img width="50" height="50" src="${curr_user.userPic}"/></c:if>
			</div> --%>
			<div class="my-comment">
				<textarea style="width: 100%;" maxlength="100" id="textarea-msg" v-model="comment.commentContent" placeholder="扯淡、吐槽、表扬、鼓励……想说啥就说啥！" cols="60" rows="6"></textarea>
				<div class="word-limit"><span id="word-count">0</span>/120</div>
				<a href="javascript:void(0);" @click="saveComment" class="comment-btn">发表评论</a>
			</div>
		<script type="text/javascript" src="<c:url value='/resources/js/user.js'/>"></script>
	</div>
	
	
	<div class="message-wrap">
			<ul class="commentList">
				<!-- <li class="empty-list" v-if="commentCount==0">还没有人评论，客官，要不说两句！</li> -->
				<li v-for="comment in commentList" class="u-message" style="background: rgba(255,255,255,.8);">
					<div class="user-img">
						<c:if test="${empty curr_user.userPic}"><img width="50" height="50" src="http://img.mukewang.com/57035ff200014b8a06000338-228-128.jpg"/></c:if>
						<c:if test="${not empty curr_user.userPic}"><img width="50" height="50" :src='comment.userImg'/></c:if>
						<!-- <img alt="" v-if="v.userPic.exist" :src="v.userPic.exist" width="50" height="50" style="border-radius:50%;"/>
						<img alt="" v-else  width="50" height="50" style="border-radius:50%;" :src="v.userPic.empty"/> -->
					</div>
					<div class="comment-body">
						<p class="comm user-name" style="padding-top: 10px;">{{comment.userName}}
							<span class="time-qian">{{comment.ctime}}</span>
							<span class="comm-zan">
								<a v-if="comment.zhuanType=='1'" href="javascript:;" style="color:red;" class="c-paizhuan c-comm" @click="paiZhuan(comment.id,$index)">
								<svg class="icon chuizhicenter" aria-hidden="true">
								  <use xlink:href="#icon-dislike__easy"></use>
								</svg>
								拍一砖(<i class="paizhuan-count comm-read-common">{{comment.paizhuanCount}}</i>)</a>
								<a v-else="comment.zhuanType=='1'" href="javascript:;" class="c-paizhuan c-comm" @click="paiZhuan(comment.id,$index)">
								<svg class="icon chuizhicenter" aria-hidden="true">
								  <use xlink:href="#icon-dislike__easy"></use>
								</svg>
								拍一砖(<i class="paizhuan-count comm-read-common">{{comment.paizhuanCount}}</i>)</a>
								<a v-if="comment.zanType=='0'"  href="javascript:;"  style="color:red;" class="c-zan c-comm" @click="dianZan(comment.id,$index)">
									<svg class="icon chuizhicenter" aria-hidden="true">
									  <use xlink:href="#icon-like__easyico"></use>
									</svg>
								赞(<i class="zan-count comm-read-common">{{comment.zanCount}}</i>)</a>
								<a v-else="comment.zanType=='0'"  href="javascript:;" class="c-zan c-comm" @click="dianZan(comment.id,$index)">
									<svg class="icon chuizhicenter" aria-hidden="true">
									  <use xlink:href="#icon-like__easyico"></use>
									</svg>
								赞(<i class="zan-count comm-read-common">{{comment.zanCount}}</i>)</a>
								<a href="javascript:;" @click="huifuComment($index)" class="c-reply c-comm">
									<svg class="icon chuizhicenter" aria-hidden="true">
									  <use xlink:href="#icon-pinglun2"></use>
									</svg>
								</i>回复(<i class="zan-count comm-read-common">1111</i>)</a>
							</span>
						</p>
						<p class="comment-content">{{comment.commentContent}}</p>
						<p class="comm comment-date" style="margin:0 16px 0 0;color:#C5C5C5;">
							<span><a class="pinglun-c" href="javascript:;" @click="huifulist($index)"><i class="iconfont icon-groupcopy5">(11)</i></a></span>
							<span><a style="display:none;" class="shouqi" href="javascript:;" @click="shouqi($index)">收起评论</a></span>
							<span>{{comment.commentDatetime}}</span>
						</p>
						<div style="clear: both;"></div>
						
						<!-- 回复 S -->
						<div class="c-huifu" style="display:none;">
							<div class="huifu-cnt">
								<textarea rows="10" cols="100" placeholder="回复该评论："></textarea>
								<div class="huifu-btn-b">
									<a href="javascrit:;" @click="huifuFunc" class="huifu-btn">发送</a>
								</div>
							</div>
						</div>
						<!-- 回复 E -->
						
						<!-- 回复列表显示 S -->
						<div>
							<div class="huifulist-cnt">
								<ul>
									<li class="c-huifulist" style="display:none;">
										<img class="tiny-img" height="30" width="30" alt="" src="https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=3986019189,2125872432&fm=85&s=AA82C54E001435C896B45D3C03005040">
										<span class="g-nickname">啊浮夸浮夸撒</span>
										<div class="huifu-g-cnt">哈哈就发货佛啊付好款撒娇好伐</div>
										<p class="huifu-g-date">2016-03-56 02:21:23</p>
										<div style="clear: both;"></div>
									</li>
									<li class="c-huifulist" style="display:none;">
										<img class="tiny-img" height="30" width="30" alt="" src="https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=3986019189,2125872432&fm=85&s=AA82C54E001435C896B45D3C03005040">
										<span class="g-nickname">啊浮夸浮夸撒</span>
										<div class="huifu-g-cnt">哈哈就发货佛啊付好款撒娇好伐</div>
										<p class="huifu-g-date">2016-03-56 02:21:23</p>
										<div style="clear: both;"></div>
									</li>
								</ul>
							</div>
						</div>
						<!-- 回复列表显示 E -->
					</div>
					<div style="clear: both;"></div>
				</li>
			</ul>
			<div v-show="goods.commentCount!=0" class="more"><a style="cursor: pointer;display:block;" @click="queryCommentList">更多</a></div>
			<%-- <input v-model="comment_page_record" type="hidden" value="${comment_page}"> --%>
			<div v-show="goods.commentCount==0">
				<div class="comm-null-wrap">
					还没有人评论哟！{{commentList}}
				</div>
			</div>

		</div>
	
	
	
	
	
	
	
	
				
				
			</div>
			
			
	
			
			
		</div>
		
		
		
	</body>
  <script type="text/javascript">
	 /*  var btn = document.getElementById('copy-cnt-btn');
	  var clipboard = new Clipboard(btn);//实例化
	  //复制成功执行的回调，可选
	  clipboard.on('success', function(e) {
		  console.log(e);
	  });
	  //复制失败执行的回调，可选
	  clipboard.on('error', function(e) {
	      console.log(e);
	  }); */
	  
	  
  	  var vm=new Vue({
  		el:"#vwrap",
  		data:{
  			login_token:'',
  			goods:{},
  			goodsId:'',
  			commentList:[],
  			comment:{},
  			commentCount:0,
  			currUser:{},
  			goodsName:'',
  			paiZhuanStatus:'',
  			b:false,
  			page: 1,
  			comment_page_record:0,
  			huifuCnt:''
  		},
  		methods:{
  			GetId :function () { 
  				var url=window.location.href;
  				return url.substr(url.lastIndexOf("/")+1,url.length);
 			},
 			showPwd:function(){
 				if(vm.login_token=='' || vm.login_token == undefined){
 					$.gnwindows.gnLoginWindow();return;
 				}
 				var flag=false;//判断该项是否已经支付完成！
 				if(!flag){
 				  layer.alert('打赏获取密码', {
 				    shade:0.3,
 				   // icon: 0,
 				    time:2000000,
 				    shift:2,
 				    closeBtn:1,
 				    shadeClose:true,
 				    btn: ['打赏'],
 				    btn1:function(index){
 				    	
// 				  		window.open("<c:url value='/user/pay.htm'/>");
 				  		location.href="../user/pay.htm";
 				  		layer.close(index);
 				  	}
 				  });
 				}else{
 					$(this).text("2s5d");
 				}
 			},
  			getGoods:function(id){
  				$.ajax({
  					type:"get",
  					url:"/WX-PLATFORM/goods/get/"+id,
  					success:function(r){
  						console.log("r===:"+JSON.stringify(r.goods));
  						vm.goods=r.goods;
  					},
  					error:function(e){
  						console.log("查询出错："+e.message);
  					}
  				});
  			},
  			queryCommentList: function (id) {
  				//var page=this.comment_page_record+1;
  				var url="/WX-PLATFORM/comment/all?gid="+this.goodsId+"&page="+this.comment_page_record;
  				layer.load('.comment');
  				$.get(url,"",function(r){
  					if(r){layer.closeAll('loading');}
  					if(r==null||r==""){
  						layer.msg("所有数据都在这，木有数据了",{time:1200});return;
  					}
  					
  					++vm.comment_page_record;
  					for ( var o in r) {
  						var commDate=r[o].commentDatetime;
  						var commMills=new Date(commDate).getTime();			//评论时间毫秒数
  						var currMills=new Date().getTime();					//当前时间毫秒数
  						var oneHourMills=60*60*1000;						//一小时毫秒数
  						var oneMinMills=60*1000;							//一分钟毫秒数
  						var millsCha=currMills-commMills;					//评论时间的毫秒数和当前时间毫秒数的差值
  						var minuCha=Math.floor(millsCha/oneMinMills);		//差值-分钟
  						var hourCha=Math.floor(millsCha/oneHourMills);		//差值-小时
  						if(minuCha<=5){
  							r[o].ctime="刚刚";
  						}else if(minuCha<60&&minuCha>5){
  							r[o].ctime=minuCha+"分钟前";
  						}else if(hourCha<24&&hourCha>1){
  							r[o].ctime=hourCha+"小时前";
  						}else{
  							var ctime=moment(commDate.substring(0,commDate.indexOf(" ")), "YYYY-MM-DD").fromNow(); //差值-天【包含一天】
  							r[o].ctime=ctime;
  						}
  						
  						
  						/*if(r!=null&&r!=''){
  							$('.commentList').append("<li v-for='comment in commentList' class='u-message' style='background: rgba(255,255,255,.8);'>"+
  									"					<div class='user-img'>"+
  									"						<c:if test='${empty curr_user.userPic}'><img width='50' height='50' src='http://img.mukewang.com/57035ff200014b8a06000338-228-128.jpg'/></c:if>"+
  									"						<c:if test='${not empty curr_user.userPic}'><img width='50' height='50' :src='"+r[o].userImg+"'/></c:if>"+
  									"						<!-- <img alt='' v-if='v.userPic.exist' :src='v.userPic.exist' width='50' height='50' style='border-radius:50%;'/>"+
  									"						<img alt='' v-else  width='50' height='50' style='border-radius:50%;' :src='v.userPic.empty'/> -->"+
  									"					</div>"+
  									"					<div class='comment-body'>"+
  									"						<p class='comm user-name' style='padding-top: 10px;'>"+r[o].userName+
  									"							<span class='time-qian'>"+r[o].ctime+"</span>"+
  									"							<span class='comm-zan'>"+
  									"								<a v-if='comment.zhuanType=='1'' href='javascript:;' style='color:red;' class='c-paizhuan c-comm' @click='paiZhuan(comment.id,$index)'>" +
  									"<svg class='icon chuizhicenter' aria-hidden='true'>"+
  									"								  <use xlink:href='#icon-dislike__easy'></use>"+
  									"								</svg>"+
  									"拍一砖(<i class='paizhuan-count'>"+r[o].paizhuanCount+"</i>)</a>"+
  									"								<a v-else='comment.zhuanType=='1'' href='javascript:;' class='c-paizhuan c-comm' @click='paiZhuan(comment.id,$index)'>" +
  									"<svg class='icon chuizhicenter' aria-hidden='true'>"+
  									"								  <use xlink:href='#icon-dislike__easy'></use>"+
  									"								</svg>"+
  									"拍一砖(<i class='paizhuan-count'>"+r[o].paizhuanCount+"</i>)</a>"+
  									"								<a v-if='comment.zanType=='0''  href='javascript:;'  style='color:red;' class='c-zan c-comm' @click='dianZan(comment.id,$index)'>" +
  									"<svg class='icon chuizhicenter' aria-hidden='true'>"+
  									"								  <use xlink:href='#icon-like__easyico'></use>"+
  									"								</svg>"+
  									"赞(<i class='zan-count'>"+r[o].zanCount+"</i>)</a>"+
  									"								<a v-else='comment.zanType=='0''  href='javascript:;' class='c-zan c-comm' @click='dianZan(comment.id,$index)'>" +
  									"<svg class='icon chuizhicenter' aria-hidden='true'>"+
  									"								  <use xlink:href='#icon-like__easyico'></use>"+
  									"								</svg>"+
  									"赞(<i class='zan-count'>"+r[o].zanCount+"</i>)</a>"+
  									"								<a href='javascript:;' @click='huifuComment($index)' class='c-reply c-comm'>" +
  									"<svg class='icon chuizhicenter' aria-hidden='true'>"+
  									"									  <use xlink:href='#icon-pinglun2'></use>"+
  									"									</svg>"+
  									"回复(8)</a>"+
  									"							</span>"+
  									"						</p>"+
  									"						<p class='comment-content'>"+r[o].commentContent+"</p>"+
  									"						<p class='comm comment-date' style='margin:0 16px 0 0;color:#C5C5C5;'>"+
  									"							<span><a class='pinglun-c' href='javascript:;' @click='huifulist($index)'><i class='iconfont icon-groupcopy5'>(11)</i></a></span>"+
  									"							<span><a style='display:none;' class='shouqi' href='javascript:;' @click='shouqi($index)'>收起评论</a></span>"+
  									"							<span>{{comment.commentDatetime}}</span>"+
  									"						</p>"+
  									"						<div style='clear: both;'></div>"+
  									"						"+
  									"						<!-- 回复 S -->"+
  									"						<div class='c-huifu' style='display:none;'>"+
  									"							<div class='huifu-cnt'>"+
  									"								<textarea rows='10' cols='100' placeholder='回复该评论：'></textarea>"+
  									"								<div class='huifu-btn-b'>"+
  									"									<a href='javascrit:;' class='huifu-btn'>发送</a>"+
  									"								</div>"+
  									"							</div>"+
  									"						</div>"+
  									"						<!-- 回复 E -->"+
  									"						"+
  									"						<!-- 回复列表显示 S -->"+
  									"						<div>"+
  									"							<div class='huifulist-cnt'>"+
  									"								<ul>"+
  									"									<li class='c-huifulist' style='display:none;'>"+
  									"										<img class='tiny-img' height='30' width='30' alt='' src='https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=3986019189,2125872432&fm=85&s=AA82C54E001435C896B45D3C03005040'>"+
  									"										<span class='g-nickname'>啊浮夸浮夸撒</span>"+
  									"										<div class='huifu-g-cnt'>哈哈就发货佛啊付好款撒娇好伐</div>"+
  									"										<p class='huifu-g-date'>2016-03-56 02:21:23</p>"+
  									"										<div style='clear: both;'></div>"+
  									"									</li>"+
  									"									<li class='c-huifulist' style='display:none;'>"+
  									"										<img class='tiny-img' height='30' width='30' alt='' src='https://ss0.baidu.com/73F1bjeh1BF3odCf/it/u=3986019189,2125872432&fm=85&s=AA82C54E001435C896B45D3C03005040'>"+
  									"										<span class='g-nickname'>啊浮夸浮夸撒</span>"+
  									"										<div class='huifu-g-cnt'>哈哈就发货佛啊付好款撒娇好伐</div>"+
  									"										<p class='huifu-g-date'>2016-03-56 02:21:23</p>"+
  									"										<div style='clear: both;'></div>"+
  									"									</li>"+
  									"								</ul>"+
  									"							</div>"+
  									"						</div>"+
  									"						<!-- 回复列表显示 E -->"+
  									"					</div>"+
  									"					<div style='clear: both;'></div>"+
  									"				</li>");
  						}
  						*/
  						
  						
  						
  						
  						
  						
  					}
  					vm.commentList=r;
  					vm.commentCount=vm.commentList.length;
  				});
  			},
  			saveComment: function (event) {
  				/*评论*/
  				var comment={
  					wordCount:[],
  					msgCnt : "",
  					msgCntFn : function(e){
  						if($.trim($(".my-comment textarea").val())==""){
  							$(".my-comment textarea").css({
  								border:"1px solid red"
  							});
  						}else{
  							//do something..
  							$(".comm-null-wrap").remove();
  							$(".message-wrap").prepend(
  								"<li style='list-style:none;background: rgba(255,255,255,.8);' class='u-message "+animate.animateStyle[Math.floor(Math.random()*animate.animateStyle.length)]+"'>"+
  									"<div class='user-img'>"+
  										"<img width='50' height='50' src='"+vm.currUser.userPic+"'>"+
  									"</div>"+
  									"<div class='comment-body'>"+
  										"<p class='comm user-name' style='padding-top: 10px;'>"+vm.currUser.usernick+"" +
  										"	<span class='time-qian'>刚刚</span>"+
  										"	<span style='display:none;' class='comm-zan'>"+
  											"	<a href='#' class='c-paizhuan c-comm'>拍一砖(0)</a>"+
  											"	<a class='c-zan c-comm' href='#'>赞(0)</a>"+
  											"	<a href='#' class='c-reply c-comm' @click='huifuComment(0)'>回复(0)</a>"+
  										"	</span>"+
  												"</p>"+
  										"<p class='comment-content'>"+$(".my-comment textarea").val()+"</p>"+
  										"<p class='comm comment-date' style='margin:0 20px 20px 0;color: #C5C5C5;'><span>"+new Date(Date.parse( new Date())).Format("yyyy-MM-dd hh:mm:ss")+"</span></p>"+
  										"<div style='clear: both;'></div>"+
  									"</div>"+
  									"<div style='clear: both;'></div>"+
  								"</li>"

  								);
  								$(".my-comment textarea").val("");
  						}
  					}
  				}
  				
  				comment.msgCnt=$.trim($(".my-comment textarea").val());
  				$(".word-limit #word-count").html("0");
  				comment.msgCntFn();
  				
  				if(vm.comment.commentContent == undefined || $.trim(vm.comment.commentContent) == ''){
  					layer.msg("请输入评论内容",{time:1000});
  					return;
  				}
  				var url = "/WX-PLATFORM/comment/save";
  				var comment=vm.comment;
  				comment.gid=vm.goods.id;
  				console.log(comment);
  				$.get(url,comment,function(r){
  					console.log(r);
  					if(r.code == 0){
  						vm.goods.commentCount++
  						layer.msg("评论成功",{time:1000});
  					}
  				});
  			},
  			getUser: function(){
  				var url="/WX-PLATFORM/rest/user.find";
  				console.log("==url---="+url);
  				$.get(url,"",function(r){
  					console.log(JSON.stringify(r));
  					vm.currUser=r;
  				});
  			},
  			del: function (event) {
  				var ids = getSelectedRows();
  				if(ids == null){
  					return ;
  				}
  				
  				confirm('确定要删除选中的记录？', function(){
  					$.ajax({
  						type: "POST",
  					    url: "../base/supplier/delete",
  					    data: JSON.stringify(ids),
  					    success: function(r){
  							if(r.code == 0){
  								alert('操作成功', function(index){
  									$("#jqGrid").trigger("reloadGrid");
  								});
  							}else{
  								alert(r.msg);
  							}
  						}
  					});
  				});
  			},
  			getCurrGoodsInfo: function(id){
  				$.get("/WX-PLATFORM/goods/get/"+id, function(r){
  					 console.log("-------------------"+JSON.stringify(r));
  					vm.goodsName=r.goods.goodsName;
  	            });
  			},
  			queryZanOrZhuan:function(id,text,i){
  				var url1="/WX-PLATFORM/comment/user.zanorzhuan.status.get";
  				var data1={"cid":id};
  				var cc=false;			//判断是否已拍过砖
  				
  				$.ajax({
  					url:url1,
  					data:data1,
  					async: false,
  					method:"GET",
  					success:function(r){
  						for(var v in r){
  							if(r[v].status==i){
  								cc=true;
  								return;
  							}
  						}
  					}
  				});
  				return cc;
  			},
  			//点赞
  			dianZan:function(id,i){
  				var text="已点过赞";
  				if(vm.queryZanOrZhuan(id,text,'0')){
  					layer.msg(text,{time:"1500"});return;
  				};
  				var zanObj=$(".commentList").find("li").eq(i).find(".c-zan");
  				var url="/WX-PLATFORM/comment/dianzan";
  				var data={"id":id};
  				$.get(url,data,function(r){
  					if(r){
  						var obj=$(".commentList").find("li").eq(i).find(".c-zan .zan-count");
  						console.log(obj.html());
  						var count=+obj.html()+1;
  						console.log("count1="+count);
  						obj.html(count);
  					}
  				});
  				
  				var urlZan="/WX-PLATFORM/comment/zanorzhuan.save";
  				var dataZan={"uid":vm.currUser.userid,"cid":id,"status":"0"};
  				$.get(urlZan,dataZan,function(r){
  					if(r){
  						gn_obj_plus.plusOne(zanObj);//点赞+1特效
  						$(".commentList").find("li").eq(i).find(".c-zan").css({"color":"red"});
  					}
  				});
  			},
  			//拍砖
  			paiZhuan:function(id,i){
  				var text="已拍过砖";
  				if(vm.queryZanOrZhuan(id,text,'1')){
  					layer.msg(text,{time:"1500"});return;
  				};
  				
  				var zhuanObj=$(".commentList").find("li").eq(i).find(".c-paizhuan");
  				var url="/WX-PLATFORM/comment/paizhuan";
  				var data={"id":id};
  				$.get(url,data,function(r){
  					if(r){
  						var obj=$(".commentList").find("li").eq(i).find(".c-paizhuan .paizhuan-count");
  						console.log("obj.html="+obj.html());
  						var count=(+obj.html())+1;
  						console.log("count2="+count);
  						obj.html(count);
  					}
  				});
  				var urlZan="/WX-PLATFORM/comment/zanorzhuan.save";
  				var dataZan={"uid":vm.currUser.userid,"cid":id,"status":"1"};
  				$.get(urlZan,dataZan,function(r){
  					if(r){
  						gn_obj_plus.plusOne(zhuanObj);//点赞+1特效
  						$(".commentList").find("li").eq(i).find(".c-paizhuan").css({"color":"red"});
  					}
  				});
  			},
  			huifuComment:function(i){
  				var u=$(".commentList").find(".u-message").eq(i);
  				var s=u.find(".comment-body .c-huifu").css("display");
  				if(s=="none"){
  					$(".commentList").find(".u-message").eq(i).find(".c-huifu").css({"display":"block"});
  					$(".commentList").find(".u-message").eq(i).find(".shouqi").css({"display":"inline-block"});
  				}else{
  					$(".commentList").find(".u-message").eq(i).find(".c-huifu").css({"display":"none"});
  					$(".commentList").find(".u-message").eq(i).find(".shouqi").css({"display":"none"});
  				}
  			},
  			shouqi:function(i){
  				var u=$(".commentList").find(".u-message").eq(i);
  				u.find(".c-huifu").css({"display":"none"});
  				u.find(".shouqi").css({"display":"none"});
  			},
  			huifulist:function(i){
  				var u=$(".commentList").find(".u-message").eq(i);
  				var s=u.find(".huifulist-cnt ul li").eq(i);
  				var s=u.find(".c-huifulist").css("display");
  				if(s=="none"){
  					u.find(".c-huifulist").css({"display":"block"});
  				}else{
  					u.find(".c-huifulist").css({"display":"none"});
  				}
  				//$(".commentList").find("li").eq(i).find(".shouqi").css({"display":"none"});
  			},
  			huifuFunc:function(o){
  				var huifuCnt=$.trim($(".huifu-cnt textarea").val());
  				if(huifuCnt==''){
  					layer.msg("请输入回复内容",{time:1500});
  				}
  			}
  			
  			
  		},
  		created: function () {
  			var id = this.GetId(); 
  			this.goodsId=id;
			if(id!=null) {
				var id = decodeURIComponent(id); 
				this.getGoods(id);
			}
			this.queryCommentList(id);
			//vm.getCurrGoodsInfo(id);
			//vm.getUser();
  		}
  		
  	});
  </script>
</html>
